class Session {
    setSession(key, value) {
        window.sessionStorage.setItem(key, value)
    }
    getSession(key) {
        if (typeof key === 'string') {
            return window.sessionStorage.getItem(key) || ''
        }
        if (key instanceof Array) {
            const setKey = [...new Set(key)]
            let newObj = {}
            setKey.forEach(item => {
                const value = window.sessionStorage.getItem(item) || ''
                if (value) {
                    newObj[item] = value
                }
            })
            return newObj
        }
    }
}
//get方法支持字符串和数组
//字符串返回字符串  数组返回对象
export default new Session()